package top.shenluw.demo.querydsl;

import org.hibernate.dialect.MySQL5Dialect;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.type.IntegerType;

/**
 * @author Shenluw
 * 创建日期：2018/9/29 15:18
 */
public class CustomMysql5Dialect extends MySQL5Dialect {
	public CustomMysql5Dialect() {
		super();
		registerFunction("bitand", new SQLFunctionTemplate(IntegerType.INSTANCE, "(?1 & ?2)"));
		registerFunction("bitor", new SQLFunctionTemplate(IntegerType.INSTANCE, "(?1 | ?2)"));
		registerFunction("bitxor", new SQLFunctionTemplate(IntegerType.INSTANCE, "(?1 ^ ?2)"));
	}
}
